<!-- 出入货件数统计 -->
<div style="height:15px;"></div>
<div id="chart_crhjstj" style="height:350px;"></div>

<script>
layui.use(['jquery', 'layer', 'highcharts'], function() {
	var $ = layui.jquery;
	var layer = layui.layer;
		
	//出入货件数统计
	window.getChartCrhjstj = function(){
		$.ajax({
			type: "POST",
			url: "?c=dailyV2&m=index",
			data: "_ajax=1&fun=_getChart&type=2&factory_id="+factoryId+"&from="+from,
			dataType: "json",
			success: function(res){
				if(res.code == 1){
					var days = res.data.days;
					var list = res.data.list;
	
					$('#chart_crhjstj').html('');
					var chart = Highcharts.chart('chart_crhjstj', {
				        title: {
				            text: '出入货件数统计',
				            x: -20 //center
				        },
				        xAxis: {
				            categories: days
				        },
				        yAxis: {
				            title: {
				                text: '数量'
				            },
				            plotLines: [{
				                value: 0,
				                width: 1,
				                color: '#808080'
				            }]
				        },
				        legend: {
				            layout: 'vertical',
				            align: 'right',
				            verticalAlign: 'middle',
				            borderWidth: 0
				        },
						plotOptions: {
							line: {
								dataLabels: {
									enabled: true,         // 开启数据标签
									formatter: function() {
										return this.y
									}
								}
							}
						},
				        series: list
				    });
				}else layer.msg(res.msg, {icon: 2,anim: 6});
			}
		});
	}

	setTimeout("getChartCrhjstj()", 4000);	// 出入货件数统计图表
	setInterval("getChartCrhjstj()", 1800000); 	// 30分钟
});
</script>